<template>
  <view class="partner-page">
    <!-- 导航栏 -->
    <up-navbar :title="useT('合伙人')" :safeAreaInsetTop="true" :autoBack="true" leftIconColor="#333" titleColor="#333" bgColor="#fff" placeholder></up-navbar>

    <!-- 用户信息卡片 -->
    <view class="user-card">
      <view class="user-info">
        <view class="user-avatar">
          <image src="/static/logo2.png" class="avatar-icon" mode="aspectFit"></image>
        </view>
        <view class="user-details">
          <view class="user-level">{{ useT('普通用户') }}</view>
          <view class="next-level">{{ useT('下一等级') }}: {{ useT('营销经理') }}</view>
        </view>
      </view>

      <!-- 进度条 -->
      <view class="progress-section">
        <view class="progress-bar">
          <view class="progress-fill" :style="{ width: progressWidth + '%' }"></view>
        </view>
        <view class="progress-text">
          {{ useT('您当前需购入') }}
          <text class="highlight">10000NKS</text>
          {{ useT('即可升级为') }}
          <text class="highlight">{{ useT('营销经理合伙人') }}</text>
        </view>
      </view>
    </view>

    <!-- 支付金额区域 -->
    <view class="payment-section">
      <view class="section-title">{{ useT('实际支付金额') }}</view>
      <view class="payment-input">
        <view class="input-left">
          <image src="/static/home/usdt-icon.png" class="currency-icon" mode="aspectFit"></image>
          <text class="amount">10000.00</text>
        </view>
        <view class="input-right">USDT</view>
      </view>

      <view class="balance-info">
        <view class="balance-item">
          <text class="label">{{ useT('可用余额') }}</text>
          <text class="value">0</text>
        </view>
        <view class="balance-item">
          <text class="label">{{ useT('当前价格') }}</text>
          <text class="value">1.0USDT/NKS</text>
        </view>
      </view>
    </view>

    <!-- 营销经理权益 -->
    <view class="benefits-section">
      <view class="section-title">{{ useT('营销经理权益') }}</view>
      <view class="benefits-list">
        <view class="benefit-item" v-for="(benefit, index) in benefitsList" :key="index">
          <view class="benefit-text">{{ index + 1 }}、{{ useT(benefit) }}</view>
        </view>
      </view>
    </view>

    <!-- 立即升级按钮 -->
    <view class="upgrade-button">
      <u-button type="primary" shape="circle" size="large" @click="handleUpgrade">{{ useT('立即升级') }}</u-button>
    </view>
  </view>
</template>

<script setup>
import { useT } from '@/utils/i18n.js';
import { computed, ref } from 'vue';

// 响应式数据
const progressWidth = ref(20); // 进度条宽度百分比
const benefits = ref(['邀请开通NEXA CARD,单张最高奖励74U;', 'U卡用户兑换时,最高可获得兑换流水的0.426%奖励;', '储蓄奖励,最高可获得储户收益的75%;', '享受分红池分红,累计分红收益不低于购股金额的3倍;', '持有币股同权资产NKST;', '享有NEXA EXWORTH集团赋予的其他未来权益。']);
const benefitsList = computed(() => {
  return benefits.value.map((benefit) => {
    return useT(benefit);
  });
});
// 方法
const handleUpgrade = () => {
  uni.navigateTo({
    url: '/pagesA/partner/upgraded'
  });
};
</script>

<style lang="scss" scoped>
.partner-page {
  min-height: 100vh;
  background-color: #f5f5f5;
  padding-bottom: 120rpx;
}

.nav-left,
.nav-right {
  width: 60rpx;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-title {
  font-size: 36rpx;
  font-weight: 600;
  color: #333;
}

.user-card {
  margin: 30rpx;
  background-color: #333;
  border-radius: 16rpx;
  padding: 40rpx;

  .user-info {
    display: flex;
    align-items: center;
    margin-bottom: 30rpx;

    .user-avatar {
      width: 80rpx;
      height: 80rpx;
      margin-right: 24rpx;

      .avatar-icon {
        width: 100%;
        height: 100%;
        border-radius: 50%;
      }
    }

    .user-details {
      .user-level {
        font-size: 32rpx;
        font-weight: 600;
        color: #fff;
        margin-bottom: 8rpx;
      }

      .next-level {
        font-size: 26rpx;
        color: #ccc;
      }
    }
  }

  .progress-section {
    .progress-bar {
      width: 100%;
      height: 8rpx;
      background-color: #555;
      border-radius: 4rpx;
      overflow: hidden;
      margin-bottom: 16rpx;

      .progress-fill {
        height: 100%;
        background-color: #12c284;
        border-radius: 4rpx;
        transition: width 0.3s ease;
      }
    }

    .progress-text {
      font-size: 24rpx;
      color: #ccc;
      line-height: 1.5;

      .highlight {
        color: #12c284;
        font-weight: 600;
      }
    }
  }
}

.payment-section {
  margin: 0 30rpx 30rpx;
  background-color: #fff;
  border-radius: 16rpx;
  padding: 30rpx;

  .section-title {
    font-size: 32rpx;
    font-weight: 600;
    color: #333;
    margin-bottom: 24rpx;
  }

  .payment-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f8f8f8;
    border-radius: 12rpx;
    padding: 24rpx;
    margin-bottom: 24rpx;

    .input-left {
      display: flex;
      align-items: center;

      .currency-icon {
        width: 40rpx;
        height: 40rpx;
        margin-right: 16rpx;
      }

      .amount {
        font-size: 32rpx;
        font-weight: 600;
        color: #333;
      }
    }

    .input-right {
      font-size: 28rpx;
      color: #666;
    }
  }

  .balance-info {
    .balance-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 16rpx;

      &:last-child {
        margin-bottom: 0;
      }

      .label {
        font-size: 26rpx;
        color: #666;
      }

      .value {
        font-size: 26rpx;
        color: #333;
      }
    }
  }
}

.benefits-section {
  margin: 0 30rpx 30rpx;
  background-color: #fff;
  border-radius: 16rpx;
  padding: 30rpx;

  .section-title {
    font-size: 32rpx;
    font-weight: 600;
    color: #333;
    margin-bottom: 24rpx;
  }

  .benefits-list {
    .benefit-item {
      display: flex;
      margin-bottom: 20rpx;

      &:last-child {
        margin-bottom: 0;
      }

      .benefit-number {
        width: 40rpx;
        height: 40rpx;
        background-color: #12c284;
        color: #fff;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24rpx;
        font-weight: 600;
        margin-right: 16rpx;
        flex-shrink: 0;
      }

      .benefit-text {
        flex: 1;
        font-size: 26rpx;
        color: #666;
        line-height: 1.6;
      }
    }
  }
}

.upgrade-button {
  margin: 0 30rpx 40rpx;

  .u-button {
    width: 100%;
    height: 88rpx;
    background-color: #12c284;
    border-radius: 44rpx;
    font-size: 32rpx;
    font-weight: 600;
    border: none;
  }
}
</style>
